<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>年龄计算</title>
    <script>
      //获取用户输入
      //let year = prompt('请您输入生日年份:')
      //转换
      //year = parseInt(year)
      //计算结果
      //let result = 2023 - year + 1
      //输出结果
      //document.write(`您的年龄是:${result}岁`)

      let age = 2023 - parseInt(prompt('请您输入生日年份:')) + 1
      document.write(`您的年龄是:${age}岁`)
    </script>
  </head>
  <body></body>
</html>
